package com.rmt.mapper;

import com.rmt.pojo.zy_news;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * @author ruoyunzifan
 * @create 2019-12-18 11:33
 */
@Mapper
public interface Zynewsmapper {
    /**
     * 查询某个类别下的
     * @param
     * @return
     */
    @Select("select * from zy_news where id=1")
    public List<zy_news> findbyid();
    /**
     * 根据关键字模糊查询
     *
     * @param title
     * @return
     */
    @Select(value = "select u.title from zy_news where title like ?1")
    public List<zy_news> findByTitle(String title);

    /**
     * 删除数据库文章
     *
     * @param
     * @return
     */
    @Select(value = "Delete u.* from zy_news  u where u.id=?1")
    @Modifying
    public void delete();

    /**
     * 根据id修改新闻
     *
     * @return
     */
    @Select(value = "update u.* from zy_news u where  u.id=?1")
    @Modifying
    public void save(zy_news zy_news1);







}
